import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

let routes = [{
        path: '/',
        redirect: "/home",
    },
    {
        path: '/home',
        name: 'home',
        component: () =>
            import ('../views/home/home.vue'),
    },
    {
        path: '/food',
        name: 'food',
        component: () =>
            import ('../views/food/food.vue'),
    },
    {
        path: '/shop',
        name: 'shop',
        component: () =>
            import ('../views/shop/shop.vue'),
    },
    {
        path: '/order',
        name: 'order',
        component: () =>
            import ('../views/order/order.vue'),
    },
    {
        path: '/mine',
        name: 'mine',
        component: () =>
            import ('../views/mine/mine.vue'),
    },
    {
        path: '/login',
        name: 'login',
        component: () =>
            import ('../views/login/login.vue'),
    },
    {
        path: '/address',
        name: 'address',
        component: () =>
            import ('../views/address/address.vue'),
    },
    {
        path: '/selectAddress',
        name: 'selectAddress',
        component: () =>
            import ('../views/selectAddress/selectAddress.vue'),
    },
    {
        path: '/integral',
        name: 'integral',
        component: () =>
            import ('../views/mine/integral.vue')
    },
    {
        path: '/vipcode',
        name: 'vipcode',
        component: () =>
            import ('../views/vipCode/vipcode.vue')
    },
    {
        path: "*",
        component: () =>
            import ("../views/nofind/nofind.vue")
    },
    {
        path:'/security_code',
        name:'security_code',
        component:()=>import('../views/login/security_code.vue'),
    },{
        path:'/phone_login',
        name:'phone_login',
        component:()=>import('../views/login/phone_login.vue'),
    },{
        path:'/forget_pwd',
        name:'forget_pwd',
        component:()=>import('../views/login/forget_pwd.vue'),
    },{
        path:'/input_scode',
        name:'input_scode',
        component:()=>import('../views/login/input_scode.vue'),
    },{
        path:'/place',
        name:'place',
        component:()=>import('../views/place/place.vue'),
    },
    {
        path:'/editInfo',
        name:'editInfo',
        component:()=>import('../views/editInfo/editInfo.vue'),
    },
    {
        path:'/orderDetail',
        name:'order_detail',
        component:()=>import('../views/orderDetail/order_detail.vue'),
    },
    {
        path:'/orderPay',
        name:'orderPay',
        component:()=>import('../views/orderPay/orderPay.vue'),
    }
]

let router = new VueRouter({
    routes
})

//路由守卫
router.beforeEach((to, from, next) => {
    return next()
})

export default router;